<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:func="http://java.sun.com/jsp/jstl/functions"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:body>
        <ui:composition template="/Shared/_adminlayout.xhtml">
            <ui:define name="rssmcontent">
                <h3>RSS Links</h3>
                <h:form>
                    <h:commandButton value="Add New" action="#{dBContext.setAddNewRSSMode()}"/>
                    <br/>
                    <span>Total: #{func:length(dBContext.allRssLinks)} links</span><br/>
                    <table id="rsslnkT" class="dataTable">
                        <tr>
                            <th>ID</th>
                            <th>CategoryID</th>
                            <th>Title</th>
                            <th>Link</th>
                            <th width="50px"></th>
                        </tr>
                        <c:forEach var="item" items="#{dBContext.allRssLinks}">
                            <tr>
                                <td>#{item.id}</td>
                                <td>#{item.categoryId}</td>
                                <td>#{item.title}</td>
                                <td>#{item.link}</td>
                                <td>
                                    <h:commandButton styleClass="updateButton" action="#{dBContext.setRSSLinkToUpdate(item)}"/>
                                    <h:commandButton styleClass="deleteButton" action="#{dBContext.setRSSLinkToDelete(item)}"/>
                                </td>
                            </tr>
                        </c:forEach>
                    </table>
                </h:form>
            </ui:define>
            <ui:define name="categorymcontent">
                <div class="inputForm">
                    <h3>Are you sure you want to delete this Category</h3>
                    <span>ID: #{dBContext.selectedCategory.categoryId}</span><br/>
                    <span>Name: #{dBContext.selectedCategory.categoryName}</span><br/>
                    <h:form>
                        <h:commandButton value="Delete" action="#{dBContext.deleteCategory()}"/>
                        <br/><br/>
                        <h:commandLink value="Back" action="/Admin/index?faces-redirect=true"/>
                    </h:form>                    
                </div>
            </ui:define>
        </ui:composition>
    </h:body>
</html>

